package com.sure.supermarketserver.sell.statistics.impl;

import com.sure.supermarketserver.sell.statistics.StatisticsService;
import com.sure.supermarketserver.sell.statistics.StatisticsVO;
import com.sure.supermarketserver.sell.statistics.dao.StatisticsDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: fyf
 * @Date: 2021/07/19/11:28
 * @Description:
 */
@Service
@Transactional
public class StatisticsServiceImpl implements StatisticsService {

    @Resource
    private StatisticsDao statisticsDao;

    @Override
    public List<StatisticsVO> statistics() {
        List<StatisticsVO> statistics = new ArrayList<>();
        try {
            statistics = statisticsDao.statistics();
        }catch (Exception e) {
            throw new RuntimeException("查询销量统计失败！", e);
        }
        return statistics;
    }
}
